package test;

class Animal{}
class Dog extends Animal{}
class Cat extends Animal{}
class PolyDemo2{
	public static void main(String[] args){
	Animal p0 = new Animal();
	Dog p1 = new Dog ();
	Cat p2 = new Cat ();
	Animal p3 = new Dog ();
	Animal p4 = new Cat ();
	//p1 = p0; //不能转
	//p1 = p2;  //不能转
	p0 = p1;
	p1 = (Dog)p3;//111
	p3 = p1;
	p1 = (Dog)p3;//111
	p1 = (Dog)p3;
	p2 = (Cat)p4;
	}
}
